package com.inspur.security.cbb3.kms.enums;

/**
 * IvLength 对称加密CBC模式下偏移量IV长度校验
 *
 * @author liukai
 * @date 2020/10/20
 **/
public enum RsaDataLength {
    /**
     * 其他
     */
    other(0),

    /**
     * CBC模式下IV长度
     */
    rsa1024(117),
    aes(245),
    sm4(501);

    int bitLength;

    RsaDataLength(int bitLength){
        this.bitLength = bitLength;
    }

    public int getBitLength() {
        return bitLength;
    }

    public static RsaDataLength getByType(String type){
        for (RsaDataLength constants : values()) {
            if (constants.name().equalsIgnoreCase(type)) {
                return constants;
            }
        }
        return other;
    }

}
